package com.project.service;

import com.project.dao.SchoolMapper;
import com.project.entity.School;
import com.project.service.base.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional(rollbackFor = Exception.class)
@Service
public class SchoolServiceImpl extends BaseService implements SchoolService{
    @Autowired
    SchoolMapper schoolMapper;

    @Override
    public void add(School school) {
        schoolMapper.insertSelective(school);
    }

    @Override
    public School findById(Integer id) {
        return schoolMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<School> findAll() {
        return schoolMapper.selectAll();
    }
}
